import request from '@/utils/request'
import qs from 'qs'

export function getAllHouseOrder(size, page) {
  return request({
    url: '/house/order/selectAll',
    method: 'get',
    params: {
      size: size,
      page: page
    }
  })
}

export function getAllHouseOrderExamine(size, page) {
  return request({
    url: '/house/order/selectAll/1',
    method: 'get',
    params: {
      size: size,
      page: page
    }
  })
}

export function getAllHouseOrderNoExamine(size, page) {
  return request({
    url: '/house/order/selectAll/0',
    method: 'get',
    params: {
      size: size,
      page: page
    }
  })
}

export function deleteHouseOrder(orderId) {
  return request({
    url: '/house/order/delete',
    method: 'get',
    params: {
      orderId: orderId
    }
  })
}

export function updateHouseOrder(houseOrder) {
  return request({
    url: '/house/order/update',
    method: 'put',
    params: {
      orderId: houseOrder.orderId,
      houseId: houseOrder.houseId,
      orderType: houseOrder.orderType,
      orderDescribe: houseOrder.orderDescribe,
      orderCost: houseOrder.orderCost,
      orderState: houseOrder.orderState
    }
  })
}

export function insertHouseOrder(houseOrder) {
  const data = {
    orderId: houseOrder.orderId,
    houseId: houseOrder.houseId,
    orderType: houseOrder.orderType,
    orderDescribe: houseOrder.orderDescribe,
    orderCost: houseOrder.orderCost,
    orderState: houseOrder.orderState
  }
  return request({
    url: '/house/order/insert',
    method: 'post',
    data: qs.stringify(data)
  })
}
